<!--
 * @Author: hucc
 * @Date: 2021-10-08 17:00:33
 * @LastEditors: hucc
 * @LastEditTime: 2021-10-08 20:23:32
 * @Description: 
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>class,style</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.13/vue.js"></script>
    <style>
        .box1 {
            width: 300px;
            height: 200px;
            border: 1px solid #333;
        }
        
        .box2 {
            border-radius: 5px;
            box-shadow: 0 0 5px blue;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class='box1 box2'>盒子一</div><br>
        <div :class="{box1:isActive}">盒子二</div><br>
        <div :class="[class1,class2]">盒子三</div><br>
        <div :style="style1">盒子四</div><br>
        <!-- 数组的形式写 style2会继承style1的样式，相同的会覆盖style1的保留自己的 -->
        <div :style="[style1,style2]">盒子五</div>
    </div>
    <script>
        let vm = new Vue({
            //当前vue实例的配置项
            el: '#app',
            data: {
                isActive: true,
                class1: " box1",
                class2: "box2",
                style1: {
                    width: '200px',
                    height: '300px',
                    fontSize: '24px',
                    border: '1px solid #333'
                        //"font-size:'24px'"
                },
                style2: {
                    width: '100px',
                    height: '100px'

                }
            },
            methods: {

            }
        })
    </script>
</body>

</html>